package study.spring.core.ioc._2_inject_bean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.*;

@Configuration
@ComponentScan("study.spring.core.ioc._2_inject_bean")
@ImportResource("classpath:spring.xml")
public class JavaCodeConfigImportXmlResource {

  public static void main(String[] args) {
    ApplicationContext context = new AnnotationConfigApplicationContext(JavaCodeConfigImportXmlResource.class);
    String[] beanDefinitionNames = context.getBeanDefinitionNames();
    for (String beanDefinitionName : beanDefinitionNames) {
      System.out.println(beanDefinitionName);
    }
    AtBeanAnnotationBean annotationBean = context.getBean(AtBeanAnnotationBean.class);
    System.out.println(annotationBean.hashCode());
    AtBeanAnnotationBeanTwo beanTwo = context.getBean(AtBeanAnnotationBeanTwo.class);
    System.out.println(beanTwo.hashCode());
    beanTwo = context.getBean(AtBeanAnnotationBeanTwo.class);
    System.out.println(beanTwo.hashCode());
    String s = annotationBean.printSomeThing();
  }
}
